[backend] Fix broken migrations (#16101)#16102
Open
fellowseb wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #16102 +/- ##
===========================================
+ Coverage 35.71% 44.40% +8.69%
===========================================
Files 3232 898 -2334
Lines 221682 95194 -126488
Branches 41430 3992 -37438
===========================================
- Hits 79169 42273 -36896
+ Misses 142513 52921 -89592
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes several backend migration scripts that became broken after an engine API regression, by updating Elasticsearch engine helper calls to pass the migration execution context explicitly.
Changes:
- Update migration calls to
elUpdate,elBulk, andelReplaceto includecontextas the first argument. - Adjust helper function signatures in the credentials encryption migration to accept/pass
context. - Ensure the legacy token migration uses the updated
elUpdate(context, ...)signature.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| opencti-platform/opencti-graphql/src/migrations/1777898748017-encrypt-credentials-at-rest.js | Passes migration context through helper functions and into elUpdate for credential field encryption. |
| opencti-platform/opencti-graphql/src/migrations/1776859399668-software_case_insensitive_standard_id.js | Updates bulk rewrite to call elBulk(context, ...) during Software standard_id migration. |
| opencti-platform/opencti-graphql/src/migrations/1776689803463-decay-rule-observable-types-to-filters.js | Updates bulk write step to call elBulk(context, ...). |
| opencti-platform/opencti-graphql/src/migrations/1776164753048-note_standard_id_abstract.js | Updates bulk write step to call elBulk(context, ...). |
| opencti-platform/opencti-graphql/src/migrations/1775570561286-update_capabilities_description.js | Updates capability patching to call elReplace(context, ...). |
| opencti-platform/opencti-graphql/src/migrations/1769815233918-legacy_token_migration.js | Fixes legacy token migration updates by calling elUpdate(context, ...). |
| opencti-platform/opencti-graphql/src/migrations/1742823297617-remove_multiple_authors.js | Fixes author cleanup migration by calling elUpdate(context, ...). |
| opencti-platform/opencti-graphql/src/migrations/1678399004322-rel-merge-adapt.js | Fixes denormalized cleanup migration by calling elUpdate(context, ...). |
| opencti-platform/opencti-graphql/src/migrations/1661196127751-artifacts.js | Fixes artifacts file migration by calling elUpdate(context, ...). |
| opencti-platform/opencti-graphql/src/migrations/1652125339035-files_database.js | Fixes files database migration by calling elUpdate(context, ...). |
ae92065 to
b952dee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Fixes broken migrations after regression in introduced in #14867.
Related issues
Checklist
Further comments